const router = require('koa-router')()
const {add,list,getId,changeOfferCar,changerentCheck,changeoverOrder} =require( '../dao/ordersDao')
router.prefix('/orders')


router.post('/add', async function (ctx, next) {
  const result = {}
  const res = await add(ctx.request.body);
  ctx.body = res
})
router.get('/list', async function (ctx, next) {
  const result = {}
  const res = await list();
  ctx.body = res
})
router.post('/getOne', async function (ctx, next) {
  const result = {}
  const {id} = ctx.request.body
  const res = await getId(id);
  ctx.body = res
})
router.post('/getOne', async function (ctx, next) {
  const result = {}
  const {id} = ctx.request.body
  const res = await getId(id);
  ctx.body = res
})
router.post('/changeOfferCar', async function (ctx, next) {
  const result = {}
  const {id} = ctx.request.body
  const res = await changeOfferCar(id);
  ctx.body = res
})
router.post('/changerentCheck', async function (ctx, next) {
  const result = {}
  const {id} = ctx.request.body
  const res = await changerentCheck(id);
  ctx.body = res
})
router.post('/changeoverOrder', async function (ctx, next) {
  const result = {}
  const {id} = ctx.request.body
  const res = await changeoverOrder(id);
  ctx.body = res
})

module.exports = router
